using System;
using System.Collections.Generic;
using DMS.BEs;

namespace ObjectFactories {
	public class GenreFactory {

		private readonly Genre[] items = new Genre[26];
		private static GenreFactory instance;

		private GenreFactory() {
			items[1] = new Genre {Name = "Rock"};
			items[2] = new Genre {Name = "Jazz"};
			items[3] = new Genre {Name = "Metal"};
			items[4] = new Genre {Name = "Alternative & Punk"};
			items[5] = new Genre {Name = "Rock And Roll"};
			items[6] = new Genre {Name = "Blues"};
			items[7] = new Genre {Name = "Latin"};
			items[8] = new Genre {Name = "Reggae"};
			items[9] = new Genre {Name = "Pop"};
			items[10] = new Genre {Name = "Soundtrack"};
			items[11] = new Genre {Name = "Bossa Nova"};
			items[12] = new Genre {Name = "Easy Listening"};
			items[13] = new Genre {Name = "Heavy Metal"};
			items[14] = new Genre {Name = "R&B/Soul"};
			items[15] = new Genre {Name = "Electronica/Dance"};
			items[16] = new Genre {Name = "World"};
			items[17] = new Genre {Name = "Hip Hop/Rap"};
			items[18] = new Genre {Name = "Science Fiction"};
			items[19] = new Genre {Name = "TV Shows"};
			items[20] = new Genre {Name = "Sci Fi & Fantasy"};
			items[21] = new Genre {Name = "Drama"};
			items[22] = new Genre {Name = "Comedy"};
			items[23] = new Genre {Name = "Alternative"};
			items[24] = new Genre {Name = "Classical"};
			items[25] = new Genre {Name = "Opera"};
		}

		static public void Reset() {
			instance=null;
		}

		static public GenreFactory GetInstance() {
			if (instance==null) instance = new GenreFactory();
		return instance;
		}

		static public IList<Genre> GetAll() {
			return GetInstance().items;
		}

		static public Genre GetByOriginalId(int? id)
		{
			return id.HasValue ? GetInstance().items[id.Value] : null;
		}
	}
}
